Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build): ensure count/pagination links account for filter/query params #1242

Merged
merged 4 commits into from
Jan 14, 2025

Conversation

wass3rw3rk
Copy link
Member

@wass3rw3rk wass3rw3rk commented Jan 14, 2025

for listing builds, the previous implementation did a count, but always returned the total count while excluding after/before query params (but honoring other filters, if present). this resulted in incorrect header links. the header links pointing at subsequent pages also didn't honor existing query params, so if you followed the links you could end up with different results.

when a count is retrieved for listing builds in a repo, it honors any
existing filters, but not before/after query params. in other words, if
you request builds for the last 7 days using "after" parameters, the
total count will still show the count value of ALL builds (honoring any
other existing filters). this change will make count honor before/after
query params and provide proper pagination.
pagination did not honor any query params that might be part of the
current pagination context
@wass3rw3rk wass3rw3rk requested a review from a team as a code owner January 14, 2025 21:00
Copy link

codecov bot commented Jan 14, 2025

Codecov Report

Attention: Patch coverage is 25.00000% with 12 lines in your changes missing coverage. Please review.

Project coverage is 56.55%. Comparing base (3e8f18b) to head (3e6d76b).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
api/pagination.go 0.00% 10 Missing ⚠️
api/build/compile_publish.go 0.00% 1 Missing ⚠️
api/webhook/post.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1242      +/-   ##
==========================================
- Coverage   56.56%   56.55%   -0.02%     
==========================================
  Files         629      629              
  Lines       35609    35619      +10     
==========================================
+ Hits        20144    20146       +2     
- Misses      14784    14792       +8     
  Partials      681      681              
Files with missing lines Coverage Δ
database/build/count_repo.go 100.00% <100.00%> (ø)
database/build/list_repo.go 80.43% <100.00%> (ø)
api/build/compile_publish.go 0.00% <0.00%> (ø)
api/webhook/post.go 0.00% <0.00%> (ø)
api/pagination.go 0.00% <0.00%> (ø)

plyr4

This comment was marked as outdated.

@plyr4 plyr4 dismissed their stale review January 14, 2025 21:07

nvm, changes incoming

@wass3rw3rk wass3rw3rk merged commit 3997d68 into main Jan 14, 2025
14 of 16 checks passed
@wass3rw3rk wass3rw3rk deleted the fix/pagination branch January 14, 2025 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants